home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / getopt.z / getopt
Text File  |  1998-10-20  |  8KB  |  133 lines

  1.  
  2.  
  3.  
  4. ggggeeeettttoooopppptttt((((1111))))                                                            ggggeeeettttoooopppptttt((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _gggg_eeee_tttt_oooo_pppp_tttt - parse command options
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _ssss_eeee_tttt _----_---- _````_gggg_eeee_tttt_oooo_pppp_tttt _o_p_t_s_t_r_i_n_g _$$$$_****_````
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      The _gggg_eeee_tttt_oooo_pppp_tttt_ssss(1) command supersedes _gggg_eeee_tttt_oooo_pppp_tttt.  For more information, see the
  16.      NOTES below.
  17.  
  18.      _gggg_eeee_tttt_oooo_pppp_tttt is used to break up options in command lines for easy parsing by
  19.      shell procedures and to check for legal options.  It recognizes
  20.      supplementary code set characters in the argument given to _o_p_t_s_t_r_i_n_g
  21.      according to the locale specified in the _LLLL_CCCC______CCCC_TTTT_YYYY_PPPP_EEEE environment variable
  22.      [see _LLLL_AAAA_NNNN_GGGG on _eeee_nnnn_vvvv_iiii_rrrr_oooo_nnnn(5)].
  23.  
  24.      _o_p_t_s_t_r_i_n_g is a string of recognized option letters; see _gggg_eeee_tttt_oooo_pppp_tttt(3C).  If a
  25.      letter is followed by a colon, the option is expected to have an argument
  26.      which may or may not be separated from it by white space.  The special
  27.      option _----_---- is used to delimit the end of the options.  If it is used
  28.      explicitly, _gggg_eeee_tttt_oooo_pppp_tttt recognizes it; otherwise, _gggg_eeee_tttt_oooo_pppp_tttt generates it; in
  29.      either case, _gggg_eeee_tttt_oooo_pppp_tttt places it at the end of the options.  The positional
  30.      parameters (_$$$$_1111 _$$$$_2222 ...) of the shell are reset so that each option is
  31.      preceded by a _---- and is in its own positional parameter; each option
  32.      argument is also parsed into its own positional parameter.
  33.  
  34. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  35.      The following code fragment shows how one might process the arguments for
  36.      a command that can take the options _aaaa or _bbbb, as well as the option _oooo,
  37.      which requires an argument:
  38.  
  39.           _ssss_eeee_tttt _----_---- _````_gggg_eeee_tttt_oooo_pppp_tttt _aaaa_bbbb_oooo_:::: _$$$$_****_````
  40.           _iiii_ffff _[[[[ _$$$$_???? _!!!!_==== _0000 _]]]]
  41.           _tttt_hhhh_eeee_nnnn
  42.                _eeee_cccc_hhhh_oooo _$$$$_UUUU_SSSS_AAAA_GGGG_EEEE
  43.                _eeee_xxxx_iiii_tttt _2222
  44.           _ffff_iiii
  45.           _ffff_oooo_rrrr _iiii _iiii_nnnn _$$$$_****
  46.           _dddd_oooo
  47.                _cccc_aaaa_ssss_eeee _$$$$_iiii _iiii_nnnn
  48.                _----_aaaa _|||| _----_bbbb_))))  _FFFF_LLLL_AAAA_GGGG_====_$$$$_iiii_;;;; _ssss_hhhh_iiii_ffff_tttt_;;;;_;;;;
  49.                _----_oooo_))))       _OOOO_AAAA_RRRR_GGGG_====_$$$$_2222_;;;; _ssss_hhhh_iiii_ffff_tttt _2222_;;;;_;;;;
  50.                _----_----_))))       _ssss_hhhh_iiii_ffff_tttt_;;;; _bbbb_rrrr_eeee_aaaa_kkkk_;;;;_;;;;
  51.                _eeee_ssss_aaaa_cccc
  52.           _dddd_oooo_nnnn_eeee
  53.  
  54.      This code accepts any of the following as equivalent:
  55.  
  56.           _cccc_mmmm_dddd _----_aaaa_oooo_aaaa_rrrr_gggg _ffff_iiii_llll_eeee _ffff_iiii_llll_eeee
  57.           _cccc_mmmm_dddd _----_aaaa _----_oooo _aaaa_rrrr_gggg _ffff_iiii_llll_eeee _ffff_iiii_llll_eeee
  58.           _cccc_mmmm_dddd _----_oooo_aaaa_rrrr_gggg _----_aaaa _ffff_iiii_llll_eeee _ffff_iiii_llll_eeee
  59.           _cccc_mmmm_dddd _----_aaaa _----_oooo_aaaa_rrrr_gggg _----_---- _ffff_iiii_llll_eeee _ffff_iiii_llll_eeee
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ggggeeeettttoooopppptttt((((1111))))                                                            ggggeeeettttoooopppptttt((((1111))))
  71.  
  72.  
  73.  
  74. FFFFIIIILLLLEEEESSSS
  75.      _////_uuuu_ssss_rrrr_////_llll_iiii_bbbb_////_llll_oooo_cccc_aaaa_llll_eeee_////_l_o_c_a_l_e_////_LLLL_CCCC______MMMM_EEEE_SSSS_SSSS_AAAA_GGGG_EEEE_SSSS_////_uuuu_xxxx_cccc_oooo_rrrr_eeee
  76.           language-specific message file [See _LLLL_AAAA_NNNN_GGGG on _eeee_nnnn_vvvv_iiii_rrrr_oooo_nnnn(5).]
  77.  
  78. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  79.      _gggg_eeee_tttt_oooo_pppp_tttt_ssss(1), _ssss_hhhh(1), _gggg_eeee_tttt_oooo_pppp_tttt(3C)
  80.  
  81. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  82.      _gggg_eeee_tttt_oooo_pppp_tttt prints an error message on the standard error when it encounters
  83.      an option letter not included in _o_p_t_s_t_r_i_n_g.
  84.  
  85. NNNNOOOOTTTTEEEESSSS
  86.      _gggg_eeee_tttt_oooo_pppp_tttt may not be supported in a future release.  For this release a
  87.      conversion tool has been provided, _gggg_eeee_tttt_oooo_pppp_tttt_cccc_vvvv_tttt.  For more information about
  88.      _gggg_eeee_tttt_oooo_pppp_tttt_ssss and _gggg_eeee_tttt_oooo_pppp_tttt_cccc_vvvv_tttt, see _gggg_eeee_tttt_oooo_pppp_tttt_ssss(1).
  89.  
  90.      Reset _OOOO_PPPP_TTTT_IIII_NNNN_DDDD to 1 when rescanning the options.
  91.  
  92.      _gggg_eeee_tttt_oooo_pppp_tttt does not support the part of Rule 8 of the command syntax standard
  93.      [see _iiii_nnnn_tttt_rrrr_oooo(1)] that permits groups of option-arguments following an
  94.      option to be separated by white space and quoted.  For example,
  95.  
  96.           _cccc_mmmm_dddd _----_aaaa _----_bbbb _----_oooo _""""_xxxx_xxxx_xxxx _zzzz _yyyy_yyyy_"""" _ffff_iiii_llll_eeee
  97.  
  98.      is not handled correctly.  To correct this deficiency, use the _gggg_eeee_tttt_oooo_pppp_tttt_ssss
  99.      command in place of _gggg_eeee_tttt_oooo_pppp_tttt.
  100.  
  101.      If an option that takes an option-argument is followed by a value that is
  102.      the same as one of the options listed in _o_p_t_s_t_r_i_n_g (referring to the
  103.      earlier EXAMPLE section, but using the following command line:  _cccc_mmmm_dddd _----_oooo _----_aaaa
  104.      _ffff_iiii_llll_eeee), _gggg_eeee_tttt_oooo_pppp_tttt always treats _----_aaaa as an option-argument to _----_oooo; it never
  105.      recognizes _----_aaaa as an option.  For this case, the _ffff_oooo_rrrr loop in the example
  106.      shifts past the _f_i_l_e argument.
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.